﻿using Agent;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Xml.Linq;

public class e
{
    protected static string a;
    protected static string b;
    [CompilerGenerated]
    private static XDocument c;
    [CompilerGenerated]
    private static Func<XElement, string> d;

    public static IDictionary<KeyValuePair<string, string>, string> a()
    {
        Dictionary<KeyValuePair<string, string>, string> dictionary = new Dictionary<KeyValuePair<string, string>, string>();
        DirectoryInfo info = new DirectoryInfo(ConfigManager.q() + @"\lang");
        if (info.Exists)
        {
            foreach (FileInfo info2 in info.EnumerateFiles("*.xml"))
            {
                string str = b(info2.FullName);
                string str2 = a(info2.FullName);
                if (!string.IsNullOrWhiteSpace(str) && !string.IsNullOrWhiteSpace(str2))
                {
                    dictionary.Add(new KeyValuePair<string, string>(info2.FullName, str2), str);
                }
            }
        }
        return dictionary;
    }

    public static void a(KeyValuePair<string, string> A_0)
    {
        a = A_0.Key;
        b = A_0.Value;
        a((XDocument) null);
        a(XDocument.Load(a));
    }

    protected static string a(string A_0)
    {
        XElement element = XDocument.Load(A_0).Element("langItems");
        if (element != null)
        {
            element = element.Element("langInfo");
            if (element != null)
            {
                element = element.Element("langISO");
                if (element != null)
                {
                    return element.Value;
                }
            }
        }
        return null;
    }

    [CompilerGenerated]
    protected static void a(XDocument A_0)
    {
        c = A_0;
    }

    [CompilerGenerated]
    private static string a(XElement A_0)
    {
        return A_0.Value;
    }

    public static string b()
    {
        return b;
    }

    protected static string b(string A_0)
    {
        XElement element = XDocument.Load(A_0).Element("langItems");
        if (element != null)
        {
            element = element.Element("langInfo");
            if (element != null)
            {
                element = element.Element("LangName");
                if (element != null)
                {
                    return element.Value;
                }
            }
        }
        return null;
    }

    [CompilerGenerated]
    protected static XDocument c()
    {
        return c;
    }

    public static string c(string A_0)
    {
        Func<XElement, bool> predicate = null;
        e.a a = new e.a {
            a = A_0
        };
        string str = a.a;
        XElement element = c().Element("langItems");
        if (element != null)
        {
            element = element.Element("langData");
            if (element == null)
            {
                return str;
            }
            if (predicate == null)
            {
                predicate = new Func<XElement, bool>(a.b);
            }
            if (d == null)
            {
                d = new Func<XElement, string>(e.a);
            }
            IEnumerable<string> source = element.Elements("Item").Where<XElement>(predicate).Select<XElement, string>(d);
            if (source.Count<string>() > 0)
            {
                str = source.First<string>();
            }
        }
        return str;
    }

    [CompilerGenerated]
    private sealed class a
    {
        public string a;

        public bool b(XElement A_0)
        {
            return (A_0.Attribute("name").Value == this.a);
        }
    }
}

